package spynx.util;

import java.io.File;
import java.io.FileNotFoundException;
import java.net.URI;

public class CsvFile extends OutFile {

	private static final long serialVersionUID = 1L;

	public CsvFile(String arg0) {
		super(new File(arg0).getAbsolutePath());
	}

	public CsvFile(URI arg0) {
		super(arg0);
	}

	public CsvFile(String arg0, String arg1) {
		super(arg0, arg1);
	}

	public CsvFile(File arg0, String arg1) {
		super(arg0.getAbsoluteFile(), arg1);
	}
	
	public synchronized void writeCsvLine(Object...args) throws FileNotFoundException {
		openFile();
		for(int i = 0; i < args.length; i++) {
			out.print(args[i]);
			if (i < args.length - 1)
				out.print(", ");
		}
		out.println();
	}
	
	public synchronized void writeCsv(Object...args) throws FileNotFoundException {
		openFile();
		for(int i = 0; i < args.length; i++) {
			out.print(args[i]);
			if (i < args.length - 1)
				out.print(", ");
		}
	}
}
